'use strict';

module.exports = {
    up: function (sequelize, DataTypes) {
        /*
          Add altering commands here.
          Return a promise to correctly handle asynchronicity.
    
          Example:
          return queryInterface.createTable('users', { id: Sequelize.INTEGER });
        */
        var SectionConfig = sequelize.createTable("SectionConfig", {
            name: {
                type: DataTypes.STRING,
                field: 'Name'
            },
            prjId: {
                type: DataTypes.INTEGER,
                field: 'PrjId',
                references: { model: "Project", key: "Id" }
            },
            mileage: {
                type: DataTypes.DOUBLE,
                field: 'Mileage'
            },
            e: {
                type: DataTypes.DOUBLE,
                field: 'E'
            },
            n: {
                type: DataTypes.DOUBLE,
                field: 'N'
            },
            h: {
                type: DataTypes.DOUBLE,
                field: 'H'
            },
            id: {
                type: DataTypes.INTEGER,
                field: 'Id',
                autoIncrement: true,
                primaryKey: true
            }
        }, {
                freezeTableName: true,
                timestamps: false,
                classMethods: {

                }
            });

        return SectionConfig;
    },

    down: function (queryInterface, Sequelize) {
        /*
          Add reverting commands here.
          Return a promise to correctly handle asynchronicity.
    
          Example:
          return queryInterface.dropTable('users');
        */
        return queryInterface.dropTable('SectionConfig');

    }
};
